home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 September
/
Macworld (1997-09).dmg
/
Shareware World
/
Utilities
/
Text Processing
/
Alpha
/
Help
/
Shells
< prev
next >
Wrap
Text File
|
1996-09-04
|
3KB
|
81 lines
TCL SHELL
The basic idea of the Tcl Shell is to provide an interactive way to access
TCL, it is *NOT* intended to serve as a pseudo-unix-shell. However, I don't
use MPW or AU/X, and therefore I implemented a few very useful unix shell
functions.
All pathnames must be mac pathnames; relative pathnames start
with colons, absolute pathnames don't. For instance, ':file1' specifies a
file named 'file1' in the current directory. '::file2' specfies a file in
the parent directory, and ':::file3' is a file in the parent's parent's
directory. Additionally, hitting the tab key w/ a partial pathname invokes
a filename-completion function that tries to fill in the rest of the
characters of the name.
The supported functions are all valid Tcl commands and the following:
cat <file>... Dump contents of files into shell window.
cd <relative or absolute pathname>
Change directory. If called w/ no arguments, go to home directory if no
arguments.
cp <file1> <file2>
or
cp <file1> .... <destDir>
Basic unix functionality, recursive.
dirs - show current directory stack. See 'pushd' and 'popd'.
grep <pat> <file>...
Grep, reasonably slow.
mkdir <dirname> - make a directory (folder)
ls [-F|l] [<file>]...
Two, mutually exclusive flags. '-F' just gives the normal display, with
a '*' behind applications and a '/' behind directories (folders). '-l'
presents a long listing, including sizes of both forks, creator, file
type, and last modification time. 'procs.tcl' includes functions 'l' and
'll' which serve as my Unix aliases to 'ls -F' and 'ls -l'.
mv <file1> <file2>
or
mv <file1> .... <destDir>
Moves a file, potentially across volume boundaries. Recursive.
popd - Pop top dir off dir stack and 'cd' to it.
pushd [<dir>] - If 'dir' specified, push current folder into directory
stack and 'cd' to dir. Otherwise, swap current dir w/ top of dir stack.
ps
Prints a list of active applications.
rm [-r] <file>...
Removes files and empty directories. "-r" allows recursive removal, but
DON'T BLAME ME IF YOU DELETE YOUR ENTIRE DRIVE!
rmdir <dirname> - remove a directory (folder)
setCreator <creator> <files> - Changes the creator of given files, which can
be glob expressions.
setType <type> <files> - Changes the type of given files, which can
be glob expressions.
wc <file>...
'wc' primitive from unix, counts lines, words, characters.
The file ":Tcl:SystemCode:shell.tcl" contains Tcl code implementing the
shell interface. You can change this to suit your tastes. One recent
goody is that you can re-execute previous commands merely by moving the
cursor to the line and hitting the return key. If there is no '>'
character on the line when you hit a carriage return, the return is an
ordinary new line.
A primitive history mechanism can be used to move up and down the last 20
commands by using control-uparrow and control-downarrow at a prompt.